﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Digitalmes.Attributes
{
    /// <summary>
    /// 工作单元
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
    public sealed class UnitOfWorkAttribute : Attribute
    {
        /// <summary>
        /// 事务隔离级别
        /// </summary>
        public IsolationLevel IsolationLevel { get; init; }

        /// <summary>
        /// 初始化一个新的实例
        /// </summary>
        /// <param name="isolationLevel">事务隔离级别，默认为 <see cref="IsolationLevel.ReadCommitted"/></param>
        public UnitOfWorkAttribute(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
        {
            IsolationLevel = isolationLevel;
        }
    }
}
